﻿<UserControl x:Class="daigou.modules.Order.OrderOperationView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:Extenders="clr-namespace:daigou.infrastructure.Extenders;assembly=daigou.infrastructure"
             mc:Ignorable="d" 
             d:DesignHeight="800" d:DesignWidth="1500" Loaded="UserControl_Loaded" FontSize="14" >
    <Grid IsEnabled="{Binding IsUIEnable}" >
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="400" />
        </Grid.ColumnDefinitions>
        <DockPanel >
            <Expander Header="查找" DockPanel.Dock="Top" IsExpanded="False" >
                <DockPanel  >
                    <Label  DockPanel.Dock="Left" Content="查找" HorizontalAlignment="Left" VerticalAlignment="Center" />
                    <Button DockPanel.Dock="Right" Content="清除"  Margin="10px" Width="100px" VerticalContentAlignment="Center" VerticalAlignment="Center" Command="{Binding CleanFilterTxtCommand}"/>

                    <TextBox Text="{Binding FilterTxt, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="15" Style="{StaticResource TB_NoBorder}" ></TextBox>
                </DockPanel>
            </Expander>
            <Rectangle Height="2" Fill="Gray" DockPanel.Dock="Top" Margin="0 5"/>
            <DockPanel  DockPanel.Dock="Top">
                <CheckBox DockPanel.Dock="Left" Content="只显示选中" VerticalContentAlignment="Center" VerticalAlignment="Center" IsChecked="{Binding IsShowOnlySelected}"  Margin="10 0 20 0"/>
                <CheckBox DockPanel.Dock="Left" Content="启用只显示" VerticalContentAlignment="Center" VerticalAlignment="Center" IsChecked="{Binding IsTimeFilterEnabled}" Margin="10 0 0 0"  />
                <Label  DockPanel.Dock="Left" Content="过去第" HorizontalAlignment="Left" VerticalAlignment="Center" />
                <Label  DockPanel.Dock="Left" Width="40" HorizontalContentAlignment="Center" Content="{Binding ElementName=slider_lastDays, Path=Value, StringFormat={}{0:1f}}" HorizontalAlignment="Left" VerticalAlignment="Center" />
                <Label  DockPanel.Dock="Left" Content="天的记录" HorizontalAlignment="Left" VerticalAlignment="Center" />
                <Button  DockPanel.Dock="Left" Content="&lt;&lt;" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10 0 0 0" MinWidth="40" Command="{Binding FilterDayDecreaseCommand}"/>
                <Button  DockPanel.Dock="Left" Content="&gt;&gt;" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="20 0" MinWidth="80" Command="{Binding FilterDayIncreaseCommand}"/>
                
                <Slider Interval="1" Maximum="50" Value="{Binding Filterlastdays}" x:Name="slider_lastDays" SmallChange="1" IsSnapToTickEnabled="True" IsSelectionRangeEnabled="False" IsMoveToPointEnabled="False" LargeChange="7" TickPlacement="Both" TickFrequency="1" Padding="0" Orientation="Horizontal" BorderThickness="1" />
            </DockPanel>
            <Rectangle Height="2" Fill="Gray" DockPanel.Dock="Top" Margin="0 5"/>

            <WrapPanel DockPanel.Dock="Top" Orientation="Horizontal" HorizontalAlignment="Stretch" >
                <Label Content="{Binding CurrentViewSelectedStatistic}" HorizontalAlignment="Left" VerticalAlignment="Center" FontWeight="Bold" Foreground="DarkGreen" />
                <Label Content="        " HorizontalAlignment="Left" VerticalAlignment="Center" FontWeight="Bold" Foreground="#FF940000" />
                <Label Content="{Binding CurrentViewSelectedItemHints}" HorizontalAlignment="Left" VerticalAlignment="Center" FontWeight="Bold" Foreground="#FF17450B" />
                <Label Content="        " HorizontalAlignment="Left" VerticalAlignment="Center" FontWeight="Bold" Foreground="#FF940000" />
                <Label Content="{Binding SelectedItemHints}" HorizontalAlignment="Left" VerticalAlignment="Center" FontWeight="Bold" Foreground="#FF940000" />
                <Label Content="        " HorizontalAlignment="Left" VerticalAlignment="Center" FontWeight="Bold" Foreground="#FF940000" />
                <Label Content="淘宝订单号或备注" HorizontalAlignment="Left" VerticalAlignment="Center" />
                <TextBox Style="{StaticResource TB_NoBorder}"  Text="{Binding EmailAdditionalInfo}" MinWidth="100" AcceptsReturn="True" AcceptsTab="True" AutoWordSelection="True" TextWrapping="Wrap"  />
                
                
                <Button Content="生成Excel" Background="LightBlue" Margin="10 0" VerticalAlignment="Center" Command="{Binding ProcessWaybillCommand}" CommandParameter="false"/>
                <Button Content="发送包裹已发邮件" VerticalAlignment="Center"  Background="OrangeRed"  Margin="10 0" Command="{Binding SendPacketDeliveredEmailCommand}" MinWidth="20" MinHeight="20" />
                <ComboBox Margin="10 0"  Name="cboxDHLAgent"
                     ItemsSource="{Binding DHLAgentList,Mode=OneWay}"
                     SelectedItem="{Binding SelectedDHLAgent}"  VerticalAlignment="Center"/>
                <Button Visibility="{Binding IsShowConfirmDialog,Converter={StaticResource BooleanToVisibilityConverterReverse}}" Content="选中出单" Background="LightSalmon" Margin="10 0" VerticalAlignment="Center" Name="btnProcessWaybill" Command="{Binding ShowConfirmDialogCommand}" Padding="20 0"/>
                <StackPanel Visibility="{Binding IsShowConfirmDialog,Converter={StaticResource BooleanToVisibilityConverter}}" Orientation="Horizontal">
                    <Button Content="确认出单" Background="Gold" Margin="10 0" VerticalAlignment="Center" Command="{Binding ProcessWaybillCommand}" CommandParameter="true" Padding="20 0"/>
                    <Button Content="取消出单" Background="LightBlue" Margin="10 0" VerticalAlignment="Center" Command="{Binding CancelProcessCommand}" Padding="20 0"/>
                </StackPanel>

            </WrapPanel>
            

            
            <Rectangle Height="2" Fill="Gray" DockPanel.Dock="Top"/>

            <WrapPanel DockPanel.Dock="Top"  Orientation="Horizontal" >
                <Button Content="不选" Background="Pink"  Margin="10 " VerticalAlignment="Center" Command="{Binding DeSelectAllCommand}" Padding="5 0" />
                <Button Content="全选" Background="Green" Foreground="White" Margin="10" VerticalAlignment="Center" Command="{Binding SelectAllCommand}" Padding="5 0" />
                <Button Content="保存选中" Background="LightGoldenrodYellow" Margin="10 10 50 10" VerticalAlignment="Center" Name="btnSaveSelected" Command="{Binding SaveSelectedOrderCommand}" Padding="5 0" />
                <Button Margin="10" VerticalAlignment="Center" Content="处理选中包裹单" Background="LightGreen" Name="btnPrintWaybills" Command="{Binding PrintWaybillsCommand}" Padding="5 0" />
                <Button Content="归到当天" VerticalAlignment="Center"  Background="Yellow"  Margin="10" Command="{Binding BringTodayCommand}" Padding="5 0"/>
                <Button Content="归到昨天" VerticalAlignment="Center"  Background="AliceBlue"  Margin="10" Command="{Binding BringYesterdayCommand}" Padding="5 0"/>
                
                <Button Margin="10" VerticalAlignment="Center" Content="批量打印" Background="Orange" Name="btnCombinePrint" Command="{Binding CombinePrintCommand}" Padding="5 0" />
                <Button Content="打开文件夹" VerticalAlignment="Center"  Background="GreenYellow"  Margin="10" Command="{Binding OpenMainDirCommand}" Padding="5 0"/>
                <Button Content="查询" VerticalAlignment="Center"  Background="Yellow"  Margin="10" Command="{Binding StartSearchCommand}" Padding="5 0"/>
                <Button Content="复制查询信息" VerticalAlignment="Center"  Background="DarkBlue" Foreground="White"  Margin="10" Command="{Binding CopyQueryMsgCommand}" Padding="5 0"/>
                <Button Margin="10" VerticalAlignment="Center" Content="选中打印标签" Background="LightBlue" Name="btnPrintCnLabel" Command="{Binding PrintSelectedCnLabelCommand}" Padding="5 0" />
            </WrapPanel>
            
            <Rectangle Height="2" Fill="Gray" DockPanel.Dock="Top" Margin="0 0 0 10"/>
            
            <ListView   ItemTemplate="{StaticResource  OrderListTemplate}"  ItemsSource="{Binding OrderCollectionView}" HorizontalAlignment="Stretch" Name="orderListView" VerticalAlignment="Stretch"  BorderBrush="{x:Null}" 
                       IsSynchronizedWithCurrentItem="True"  Extenders:ListViewExtender.AutoScrollToCurrentItem="True">
                
            </ListView>

        </DockPanel>
        <ScrollViewer Grid.Column="1" >
        <StackPanel Orientation="Vertical">

                <DockPanel>
                    <Label DockPanel.Dock="Left" Content="{Binding ElementName=orderListView,Path=SelectedItem.Order.ID}"  VerticalAlignment="Stretch"  VerticalContentAlignment="Center" FontSize="20" Foreground="#FF000096" FontWeight="Black" />
                    <TextBox Style="{StaticResource TB_NoBorder}" IsReadOnly="True" Text="{Binding ElementName=orderListView,Path=SelectedItem.Recipient.Name}"  FontSize="35" />
                </DockPanel>
                <TextBlock  Text="{Binding ElementName=orderListView,Path=SelectedItem.Recipient.FormatDisplay}" TextWrapping="Wrap" />
            
            <Rectangle Height="2" Fill="Gray" DockPanel.Dock="Top"/>

            <StackPanel Orientation="Horizontal">
                <Label  Content="{Binding ElementName=orderListView,Path=SelectedItem.Recipient.AgentName}" FontWeight="Bold" Foreground="#FF0000C8" />
                <Label  Content="{Binding ElementName=orderListView,Path=SelectedItem.Recipient.QQNumber}" Foreground="#FF641900" />
            </StackPanel>
                <Rectangle Height="2" Fill="Gray" DockPanel.Dock="Top"/>
            
            <Label  Content="报关内容 [商品名] [个数] [净重] [单价]"  />
            <TextBox Style="{StaticResource TB_NoBorder}" Text="{Binding ElementName=orderListView,Path=SelectedItem.Order.Detail, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="20" Foreground="DarkBlue" AcceptsReturn="True" AcceptsTab="True" AutoWordSelection="True" TextWrapping="Wrap" VerticalScrollBarVisibility="Visible" MinHeight="80"></TextBox>

            <Rectangle Height="2" Fill="Gray" DockPanel.Dock="Top"/>


            <Label  Content="发货详情"  />
            <TextBox Style="{StaticResource TB_NoBorder}" Text="{Binding ElementName=orderListView,Path=SelectedItem.Order.Content, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="20" Foreground="DarkBlue" AcceptsReturn="True" AcceptsTab="True" AutoWordSelection="True" TextWrapping="Wrap" VerticalScrollBarVisibility="Visible" MinHeight="120"></TextBox>


          
            <Rectangle Height="2" Fill="Gray" DockPanel.Dock="Top"/>


            <StackPanel Orientation="Horizontal" Margin="0 10">
                <Label  Content="包裹单重量[KG]"  />
                <TextBox Text="{Binding ElementName=orderListView,Path=SelectedItem.Order.PacketWeight,UpdateSourceTrigger=PropertyChanged}" MinWidth="60" Style="{StaticResource TB_NoBorder}"></TextBox>
            </StackPanel>

            <Rectangle Height="2" Fill="Gray" DockPanel.Dock="Top"/>

            <StackPanel Orientation="Horizontal" Margin="0 10" >
                <Label  Content="运单号"  />
                <TextBox Text="{Binding ElementName=orderListView,Path=SelectedItem.Order.DhlSn,UpdateSourceTrigger=PropertyChanged}" MinWidth="330" Style="{StaticResource TB_NoBorder}"></TextBox>                
            </StackPanel>

            <Rectangle Height="2" Fill="Gray" DockPanel.Dock="Top"/>

            <StackPanel Orientation="Horizontal" Margin="0 10 0 0">
                <Button Content="保存" Height="25" Margin="10" Width="250" Background="LightGreen" Name="btnSave" Command="{Binding SaveOrderCommand}"/>
                <Button Content="删除" Height="25" Margin="40 10" Width="60"  Name="btnDelete"  Background="red" Command="{Binding DeleteOrderCommand}"/>
            </StackPanel>

                <Label  Content="订单备注 [只自己看 ]"  />
                <TextBox Style="{StaticResource TB_NoBorder}" Text="{Binding ElementName=orderListView,Path=SelectedItem.Order.Remark, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="20" Foreground="DarkBlue" AcceptsReturn="True" AcceptsTab="True" AutoWordSelection="True" TextWrapping="Wrap" VerticalScrollBarVisibility="Visible" MinHeight="120"></TextBox>

                <Label  Content="发货邮件备注 [通过邮件发给客户]"  />
                <TextBox Style="{StaticResource TB_NoBorder}" Text="{Binding ElementName=orderListView,Path=SelectedItem.Order.EmailRemark, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="20" Foreground="DarkBlue" AcceptsReturn="True" AcceptsTab="True" AutoWordSelection="True" TextWrapping="Wrap" VerticalScrollBarVisibility="Visible" MinHeight="120"></TextBox>

                <Label  Content="订单状态"  />
                <TextBox Style="{StaticResource TB_NoBorder}" Text="{Binding ElementName=orderListView,Path=SelectedItem.Order.OrderStatusTags, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="20" Foreground="DarkBlue" AcceptsReturn="True" AcceptsTab="True" AutoWordSelection="True" TextWrapping="Wrap" VerticalScrollBarVisibility="Visible" MinHeight="120"></TextBox>
            </StackPanel>
        </ScrollViewer>
    </Grid>
</UserControl>
